package com.forte.cartdao;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import com.forte.productdao.Product;

@Entity(name="cartproduct")
public class CartProduct implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Id
	@Column
	private int cartProductId;
	
	@Column
	private int cartId; 
	
	@Column
	private int productId;
	
	@Column
	private int quantity;	
	
	@ManyToOne
	@JoinColumn(name="cartId", insertable=false, updatable=false)
	private Cart cart;
	
	@ManyToOne
	@JoinColumn(name="productId", insertable=false, updatable=false)
	private Product product;

	public int getCartProductId() {
		return cartProductId;
	}

	public void setCartProductId(int cartProductId) {
		this.cartProductId = cartProductId;
	}

	public int getUserId() {
		return cartId;
	}

	public void setUserId(int userId) {
		this.cartId = userId;
	}

	public int getProductId() {
		return productId;
	}

	public void setProductId(int productId) {
		this.productId = productId;
	}

	public int getQuantity() {
		return quantity;
	}

	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}
	
	public Cart getCart(){
		return cart;
	}
	
	public Product getProduct(){
		return product;
	}
	
	public void setCart(Cart cart){
		this.cart = cart;
	}
	
	public void setProduct(Product product){
		this.product = product;
	}
}
